<template>
	<view>
		<button :loading="loading" :disabled="loading" type="primary" class="btn" @click="showAd">短视频</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				loading: false
			}
		},
		onLoad() {
			// HBuilderX 标准基座真机运行测试内容联盟广告位标识（adpid）为：1111111112
			// adpid: 1111111112 仅用于测试，发布时需要改为广告后台（https://uniad.dcloud.net.cn/）申请的 adpid
			// 广告后台申请的广告位(adpid)需要自定义基座/云打包/本地打包后生效

			this.adOptions = {
				// adpid: 1385062416
				adpid:1111111112
			}
			plus.ad.showContentPage(this.adOptions, (res) => {
				this.loading = false;
			}, (err) => {
				this.loading = false;
				console.log(err);
			});
		},
		methods: {
			showAd() {
				if (this.loading == true) {
					return;
				}

				this.loading = true;
				plus.ad.showContentPage(this.adOptions, (res) => {
					this.loading = false;
				}, (err) => {
					this.loading = false;
					console.log(err);
				});
			}
		}
	}
</script>